<!-- 红包列表 -->
<template>
  <div class="page-box h100 display-flex czbj">
    <p class="title-label">用户列表</p>
    <div class="mt10">
      <dxtable
        czWidth="240"
        :dataJson="dataJson"
        :formJson="formJson"
        :portUrl="portUrl"
        :qx="qx"
        ref="databale"
        :czFun="czFun"
      >
      </dxtable>
    </div>
  </div>
</template>
<script lang="ts" setup>
import dxtable from "./../../components/util/dxtable.vue";
import { dxget, dxpost, qurl, hf, prefixS } from "./../../util/index";
import { h, ref, reactive } from "vue";
import { NButton } from "naive-ui";
import sort from "../../components/util/sort.vue";

import expenseCalendar from "./expenseCalendar.vue";
const showModal = ref(false);
const openid = ref();
const initeer = () => {
  databale.value.initDataExpose();
};
const databale = ref();
// 弹窗公用该列表
let dataJson = reactive([
  {
    title: "活动logo",
    key: "logo",
    width: 80,
    render(row) {
      return h("img", { class: "dsfsdtrtr", src: row.logo });
    },
  },
  {
    title: "活动名称",
    key: "name",
    search: true, // 是否在搜索栏展示
  },
  {
    title: "分享图标",
    key: "background",
    width: 80,
    render(row) {
      return h("img", { class: "dsfsdtrtr", src: row.background });
    },
  },
  {
    title: "简介",
    key: "synopsis",
  },
  {
    title: "红包余额",
    key: "randomMoney",
    width: 80,
    render(row) {
      return h("span", { class: "red" }, row.randomMoney + "万");
    },
  },
  {
    title: "红包总数量",
    key: "numtotals",
    width: 100,
  },
  {
    title: "排序",
    width: 100,
    render(row) {
      row.databaseName = "hbcjlist";
      return h(sort, {
        row,
        onCallBack: () => {
          initeer();
        },
      });
    },
  },
  {
    title: "添加时间",
    key: "addTime",
    width: "140",
    type: "daterange",
  },
]);
const Userid = localStorage.id;
let portUrl = "hbcj/hbcjlist";
const qx = {
  DeletePermissionID: "redRedPacketListdel", //删除
  EditPermissionIdentifier: "redRedPacketListbj", // 编辑
  NewPermissionIdentifier: "redRedPacketListxz", // 新建
  ViewPermissionID: "redRedPacketListck", // 查看
};
let formJson = reactive([
  {
    title: "活动logo",
    key: "logo",
    type: "img",
    required: true,
  },

  {
    title: "分享图标",
    key: "background",
    type: "img",
    required: true,
  },
  {
    title: "活动名称",
    key: "name",
    type: "input",
    span: "24",
    required: true,
  },
  {
    title: "自定义分享标题",
    key: "zdytitle",
    type: "input",
    required: true,
    span: "12",
  },
  {
    title: "分享自定义封面",
    key: "zdyfm",
    type: "img",
    required: true,
    span: "12",
  },
  {
    title: "自定义分享链接",
    key: "AdvertisingLink",
    type: "input",
    span: "24",
    required: true,
  },
  {
    title: "最后一步链接",
    key: "zidtzlk",
    type: "input",
    span: "24",
    required: true,
  },
  {
    title: "域名地址",
    key: "ym",
    type: "input",
    span: "24",
    required: true,
  },
  {
    title: "红包余额",
    key: "randomMoney",
    type: "input",
    span: "12",
    required: true,
  },
  {
    title: "红包总数量",
    key: "numtotals",
    type: "input",
    span: "12",
    required: true,
  },
  {
    title: "简介",
    key: "synopsis",
    type: "textarea",
    required: true,
  },
]);
const czFun = {
  fun: (row, loading) => {
    return [
      h(
        NButton,
        {
          type: "info",
          quaternary: true,
          onClick: async (e) => {
            navigator.clipboard.writeText(row.ym + "?id=" + row.id + "&v=6");
            window.$message.success("复制成功！");
          },
        },
        "复制活动链接"
      ),
    ];
  },
};
</script>
